<?php
// Include the default css
drupal_add_css(drupal_get_path('module', 'bookkeep') .'/bk_invoice.css');
?>

<table>
	<th>Name</th>
	<th>Ref</th>
	<th>Company</th>
	<!--<th>issued</th>-->
	<th>Action</th>

<?php

foreach($nodes as $node) {
	
	// Handle overdue
	$dateIssued = $node->field_issued[0]['value'];
	$dateDue = 	
		
	$html = '<tr>';
	
	$html.= '<td>'.$node->title.'</td>';
	$html.= '<td>'.$node->field_ref[0]['value'].'</td>';
	$html.= '<td>'.$node->field_invoice_companynode[0]['value']->title.'</td><td>';
	
	if(user_access('administer invoices') == true) {
		$html.= '
			<a href="/node/'.$node->nid.'/edit">edit</a> |
		';
	}
	
	$html.= '  <a href="/invoices/view/'.$node->nid.'">view</a> | ';
	$html.= '  <a href="/invoices/pdf/'.$node->nid.'">pdf</a>';
	
	$html.= '</td></tr>';
	
	print $html;
}

?>
</table>